import 'package:flutter/material.dart';

import '../../../../res/myColors.dart';


class SyMyListView2 extends StatelessWidget {
  const SyMyListView2({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      itemCount: 2,
      // 总共显示 20 项
      scrollDirection: Axis.vertical,
      // 列表垂直滚动
      reverse: false,
      // 是否倒序，false 表示从上往下滚动
      controller: ScrollController(),
      // 控制滚动位置（非必须）
      primary: false,
      // 如果为 true，不允许同时设置 controller
      physics: const NeverScrollableScrollPhysics(),
      // iOS 回弹效果
      shrinkWrap: true,
      // 整体内边距
      keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
      padding: EdgeInsets.zero,
      separatorBuilder: (context, index) => SizedBox(height: 5),
      itemBuilder: (context, index) {
        return getListItemView(context, index, 1);

      },
    );
  }
  Widget getListItemView(BuildContext context, int index, int type) {
    return Container(
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(top: 8,bottom: 8),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius:BorderRadius.circular(5),
      ),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                margin: EdgeInsets.only(left: 8),
                child: Row(
                  children: [
                    Text(
                      '王女士',
                      style: TextStyle(
                        fontSize: 14,
                        fontWeight: FontWeight.bold,
                        color: myColors.c_191919,
                      ),
                    ),
                    SizedBox(width: 5),
                    Text('|'),
                    SizedBox(width: 5),
                    Text(
                      '家员老伴',
                      style: TextStyle(
                        fontSize: 14,
                        fontWeight: FontWeight.bold,
                        color: myColors.c_191919,
                      ),
                    ),
                  ],
                ),
              ),
              Container(
                margin: EdgeInsets.only(right: 8),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    Text(
                      '12000-20000/时新',
                      style: TextStyle(
                        color: myColors.c_B51C21,
                        fontSize: 14,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
          SizedBox(height: 8),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                margin: EdgeInsets.only(left: 10),
                child: Row(
                  children: [
                    Text('黑龙江人', style: TextStyle(color: myColors.c_707070)),
                    Container(
                      alignment: Alignment.center,
                      width: 5,
                      child: Text(
                        '|',
                        style: TextStyle(color: myColors.c_707070),
                      ),
                    ),
                    Text('45岁', style: TextStyle(color: myColors.c_707070)),
                    Container(
                      alignment: Alignment.center,
                      width: 5,
                      child: Text(
                        '|',
                        style: TextStyle(color: myColors.c_707070),
                      ),
                    ),
                    Text('10年以上工作经验', style: TextStyle(color: myColors.c_707070)),
                  ],
                ),
              ),

            ],
          ),
          SizedBox(height: 8),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                child: Row(
                  children: [
                    ...['服务999+客户', '手脚勤快', '普通话好'].map((title) => Container(
                      margin: EdgeInsets.only(left: 8),
                      padding: EdgeInsets.all(2),
                      decoration: BoxDecoration(
                        color: myColors.c_B5B5B5,
                        borderRadius: BorderRadius.circular(3),
                      ),
                      child: Text(title,style: TextStyle(fontSize: 10,color: myColors.c_191919),),
                    )
                    ),
                  ],
                )
              ),
              Container(
                width: 50,
                // 按钮宽度
                height: 20,
                // 按钮高度
                alignment: Alignment.center,
                margin: EdgeInsets.only(right: 8),
                // 文字居中
                decoration: BoxDecoration(
                  color: Colors.blue, // 按钮背景色
                  borderRadius: BorderRadius.circular(50), // 圆角
                  boxShadow: [
                    // 阴影效果（可选）
                    BoxShadow(
                      color: Colors.black.withOpacity(0.2),
                      blurRadius: 4,
                      offset: Offset(0, 2),
                    ),
                  ],
                  gradient: LinearGradient(
                    // 渐变背景（可选）
                    colors: [myColors.c_F89596, myColors.c_FF4142],
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                  ),
                ),
                child: Text(
                  '锁定',
                  style: TextStyle(
                    color: Colors.white, // 字体颜色
                    fontSize: 10, // 加粗
                  ),
                ),
              ),
            ],
          )
        ],
      ),
    );
  }
}